﻿<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="dondathang.aspx.cs"
    Inherits="Cucre.dondathang" Title="MUARE.VN - Đơn đặt hàng" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<%@ Import Namespace="DTO" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="DAO" %>
<%@ Import Namespace="BUS" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="padding-left: 6px;">
        <div class="clear">
        </div>
        <div class="br">
        </div>
        <div class="content_home">
            <%-- vùng thể hiện menu --%>
            <div class="ch_1 font">
                <div class="l">
                    <div class="ll">
                    </div>
                    <div class="lc">
                        <ul id="tab_menu">
                            <li id="tabmnu_1"><a href="ProfileInfo.aspx"><span class="tab_mnu_l"></span><span
                                class="tab_mnu_c">THÔNG TIN CÁ NHÂN&nbsp;</span><span class="tab_mnu_r"></span></a></li>
                            <li id="tabmnu_4"><a href="dondathang.aspx"><span class="tab_mnu_l_curent"></span><span
                                class="tab_mnu_c_curent">ĐƠN ĐẶT HÀNG&nbsp;</span> <span class="tab_mnu_r_curent">
                                </span></a></li>
                            <li id="tabmnu_3"><a href="lichsumuahang.aspx"><span class="tab_mnu_l"></span><span
                                class="tab_mnu_c">LỊCH SỬ MUA HÀNG&nbsp;</span> <span class="tab_mnu_r"></span></a>
                            </li>
                        </ul>
                    </div>
                    <div class="lr">
                    </div>
                </div>
                <div class="r">
                </div>
                <div class="clear">
                </div>
            </div>
            <%-- het vung menu --%>
            <%-- vùng làm việc --%>
            <div class="ch_2">
                <div style="padding: 1px; padding-left: 4px; padding-top: 10px;">
                    <%
                        MEMBER member = (MEMBER)Session["user_login"];
                        List<ORDER> listOrder = new List<ORDER>();
                        try
                        {
                            listOrder = OrderBUS.GetOrderByMember(member.IDMEMBER);
                            if (listOrder.Count > 0)
                            { }
                        }
                        catch (Exception ex)
                        {
                            listOrder = new List<ORDER>();
                        }
                        if (listOrder.Count > 0)
                        {
                            for (int i = 0; i < listOrder.Count; i++)
                            {
                                if (listOrder[i].STATUS_ORDER != 0)
                                {
                                    continue;
                                }
                                PRODUCT product = ProductBUS.GetProduct(listOrder[i].IDPRODUCT);
                                if (product == null)
                                {
                                    continue;
                                }
                                string timeOrder = String.Format("{0:dd/MM/yy}", listOrder[i].TIME_ORDER.Value);
                                HyperLink1.NavigateUrl = "chitietsanpham.aspx?IDSanPham=" + product.IDPRODUCT.ToString();
                                string slogan = product.Name_Product;
                                string soLuong = listOrder[i].QUANTITY.ToString();
                                string giaSanPham = String.Format("{0:0,0}", product.PRICE);
                                string tongTien = String.Format("{0:0,0}", product.PRICE.Value * int.Parse(soLuong));
                                string tinhTrang = listOrder[i].STATUS_ORDER.Value == 0 ? "Đang giao hàng" : listOrder[i].STATUS_ORDER.Value == 1 ? "Đã thanh toán" : "Hoàn tiền";
                                Image2.ImageUrl = "~/" + product.IMAGE + "2.jpg";
                    %>
                    <div class="type_info" style="margin-right: 15px;">
                        <div class="frame">
                            <div>
                                <span class="date">Thời gian đặt hàng:
                                    <%=timeOrder%></span>
                                <asp:HyperLink ID="HyperLink1" runat="server" CssClass="detail">Xem chi tiết</asp:HyperLink>
                            </div>
                            <div class="clear">
                            </div>
                            <div class="info_1">
                                <a href="#" class="title" title=" "><font style="font-size: large">
                                    <%=slogan %></font> </a>
                                <div class="clear">
                                </div>
                                <div class="info_2">
                                    <div class="table-1">
                                        Số lượng:
                                        <%=soLuong %>
                                        <br />
                                        Giá:
                                        <%=giaSanPham %>
                                        VNĐ
                                        <br />
                                        Tổng tiền:
                                        <%=tongTien %>
                                        VNĐ
                                        <br />
                                    </div>
                                    <div class="table-3">
                                        Tình trạng:
                                        <%=tinhTrang %>
                                    </div>
                                    <div style="margin-top: 5px" class="hethan_small">
                                    </div>
                                </div>
                                <div class="info_3">
                                    <a href="#" title=" ">
                                        <asp:Image ID="Image2" runat="server" Width="200" Height="133" BorderWidth="0" /></a>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                    <%
                        i++;
                        if (i < listOrder.Count)
                        {
                            if (listOrder[i].STATUS_ORDER != 0)
                            {
                                continue;
                            }
                            product = ProductBUS.GetProduct(listOrder[i].IDPRODUCT);
                            if (product == null)
                            {
                                continue;
                            }
                            product = ProductBUS.GetProduct(listOrder[i].IDPRODUCT);
                            timeOrder = String.Format("{0:dd/MM/yy}", listOrder[i].TIME_ORDER.Value);
                            HyperLink2.NavigateUrl = "chitietsanpham.aspx?IDSanPham=" + product.IDPRODUCT.ToString();
                            slogan = product.Name_Product;
                            soLuong = listOrder[i].QUANTITY.ToString();
                            giaSanPham = String.Format("{0:0,0}", product.PRICE);
                            tongTien = String.Format("{0:0,0}", product.PRICE.Value * int.Parse(soLuong));
                            tinhTrang = listOrder[i].STATUS_ORDER.Value == 0 ? "Đang giao hàng" : listOrder[i].STATUS_ORDER.Value == 1 ? "Đã thanh toán" : "Hoàn tiền";
                            Image1.ImageUrl = "~/" + product.IMAGE + "2.jpg";
                    %>
                    <div class="type_info">
                        <div class="frame">
                            <div>
                                <span class="date">Thời gian đặt hàng:
                                    <%=timeOrder%></span>
                                <asp:HyperLink ID="HyperLink2" runat="server" CssClass="detail">Xem chi tiết</asp:HyperLink>
                            </div>
                            <div class="clear">
                            </div>
                            <div class="info_1">
                                <a href="#" class="title" title=" "><font style="font-size: large">
                                    <%=slogan%></font> </a>
                                <div class="clear">
                                </div>
                                <div class="info_2">
                                    <div class="table-1">
                                        Số lượng:
                                        <%=soLuong %>
                                        <br />
                                        Giá:
                                        <%=giaSanPham %>VNĐ
                                        <br />
                                        Tổng tiền:
                                        <%=tongTien %>
                                        VNĐ
                                        <br />
                                    </div>
                                    <div class="table-3">
                                        Tình trạng:
                                        <%=tinhTrang%>
                                    </div>
                                    <div style="margin-top: 5px" class="hethan_small">
                                    </div>
                                </div>
                                <div class="info_3">
                                    <a href="#" title="">
                                        <asp:Image ID="Image1" runat="server" Width="200" Height="133" BorderWidth="0" /></a>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                    <%
                        }
                    %>
                    <%
                        }
                    %>
                    <div class="br">
                    </div>
                    <div class="br">
                    </div>
                    <div class="clear">
                    </div>
                    <div class="br">
                    </div>
                </div>
                <div style="height: 20px" align="center">
                </div>
            </div>
        </div>
        <%
            }
                        else
                        {
                        }
        %>
        <%--đường kẻ ngang phía dưới --%>
        <div style="background: url(images/temp2_3.gif) no-repeat left bottom; padding-left: 18px;
            height: 11px;">
        </div>
        <%-- --%>
    </div>
</asp:Content>
